package de.fhaugsburg.games.boardgames.scrabble.gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;

import javax.swing.BorderFactory;
import javax.swing.JPanel;

public class GSquareDetails extends JPanel {

	//FIXME: Bad!
	private static final String IMG = ScrabbleMainWindow.IMG;

	BufferedImage backgroundImage;
	String backgroundDescription;
	
	
	
	public GSquareDetails(BufferedImage backgoundImage, String backgroundDescription){
		super();
		setDoubleBuffered(true);
//		try {
//			backgroundImage = ImageIO.read(new File(IMG + "add.png"));
//		} catch (IOException ex) {
//		}
		this.backgroundImage = backgoundImage;
		this.backgroundDescription = backgroundDescription;
		
		setToolTipText(backgroundDescription);
		
		setPreferredSize(new Dimension(16, 16));
	 	setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1));

	}
	    
	
	
	
	
	public void paintComponent(Graphics g) {
		super.paintComponent(g);
		
//	    Graphics2D g2d = (Graphics2D) g;
//		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,         RenderingHints.VALUE_ANTIALIAS_ON);

		g.drawImage(backgroundImage, 0, 0, backgroundImage.getWidth(), backgroundImage.getHeight(), this);
		
		//FIXME: use cross-plattform fonts
//		Font font = new Font("Arial",Font.PLAIN, 6);
//		g.drawString(backgroundDescription, 8, 8);
		
	}

}
